package com.clms.maintain.controller;

import com.clms.common.R;
import com.clms.maintain.pojo.entity.TbRecord;
import com.clms.maintain.pojo.vo.RecordVo;
import com.clms.maintain.service.RecordService;
import io.swagger.annotations.ApiSort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: clms-third
 * @description: 维修记录的实现类
 * @author: 许鹏
 * @create: 2021-07-23 14:46
 **/
@RestController
@RequestMapping("record")
public class RecordController {

    @Autowired
    private RecordService recordService;





    @PostMapping("select/{currentPage}/{pageSize}")
    public R selectRecordAll(@PathVariable("currentPage") Integer currentPage, @PathVariable("pageSize") Integer pageSize,@RequestBody RecordVo recordVo){
        return recordService.selectRecordAll(currentPage,pageSize,recordVo);
    }

    @PostMapping("insert")
    public R insertRecord(@RequestBody TbRecord tbRecord){
        return recordService.insertRecord(tbRecord);
    }

    @PutMapping("update")
    public R updateRecord(@RequestBody TbRecord tbRecord){
        return recordService.updateRecord(tbRecord);
    }

    @GetMapping("selectById/{id}")
    public R selectById(@PathVariable Integer id){
        return recordService.selectById(id);
    }

    @DeleteMapping("delete/{id}")
    public R deleteRecord(@PathVariable Integer id){
        return recordService.deleteRecord(id);
    }
}
